package com.cro.prison.entity.constant;

public enum DISCIPLINE_PRISONER {

    OUT_DATE("不守时",3),
    CLIMB("攀爬",1),
    GATHER("聚集",2);
    private String name;
    private Integer code;

    DISCIPLINE_PRISONER(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public static String getValue(Integer code) {
        for (DISCIPLINE_PRISONER value : DISCIPLINE_PRISONER.values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }

    public static Integer getCode(String name) {
        for (DISCIPLINE_PRISONER value : DISCIPLINE_PRISONER.values()) {
            if (value.getName().equals(name)) {
                return value.getCode();
            }
        }
        return null;
    }
}
